function gradient(id, level)
{
	var box = document.getElementById(id);
	box.style.opacity = level;
	box.style.MozOpacity = level;
	box.style.KhtmlOpacity = level;
	box.style.filter = "alpha(opacity=" + level * 100 + ")";
	box.style.display="block";
	return;
}


function fadein(id) 
{
	var level = 0;
	while(level <= 1)
	{
		setTimeout( "gradient('" + id + "'," + level + ")", (level* 400) + 10);
		level += 0.01;
	}
}



// Open the lightbox


function openbox(id_box,formtitle)
{
   
  	var box = document.getElementById(id_box); 
  	document.getElementById('div_che').style.display='block';
  	var btitle = document.getElementById('boxtitle');
  	btitle.innerHTML = 'Xác nhận';
 	gradient(id_box, 0);
	fadein(id_box);
}


// Close the lightbox

function closebox(id)
{
   document.getElementById(id).style.display='none';
   document.getElementById('div_che').style.display='none';
}

// Open the lightbox

// Box cho article quan ly menu
function openbox_article(id_box,formtitle)
{
   
  	var box = document.getElementById(id_box); 
  	document.getElementById('div_article').style.display='block';
  	var btitle = document.getElementById('title_article');
  	btitle.innerHTML = formtitle;
 	gradient(id_box, 0);
	fadein(id_box);
}


// Close the lightbox

function closebox_article(id)
{
   document.getElementById(id).style.display='none';
   document.getElementById('div_article').style.display='none';
}

function get_id_article(obj_form, p_nid)
{
	document.getElementById("txt_article").value = p_nid;
	document.form_main.submit();	
}


// Box cho product quan ly menu
function openbox_product(id_box,formtitle)
{
   
  	var box = document.getElementById(id_box); 
  	document.getElementById('div_product').style.display='block';
  	var btitle = document.getElementById('title_product');
  	btitle.innerHTML = formtitle;
 	gradient(id_box, 0);
	fadein(id_box);
}


// Close the lightbox

function closebox_product(id)
{
   document.getElementById(id).style.display='none';
   document.getElementById('div_product').style.display='none';
}

function get_id_product(obj_form, p_nid)
{
	document.getElementById("txt_product").value = p_nid;
	document.form_main.submit();	
}


